#!/bin/bash

if [ "$1" = "" ]; then

        DEVICE=ppp0

else

        DEVICE=$1

fi

if [ -r /var/run/$DEVICE.pid ]; then

        kill -INT `cat /var/run/$DEVICE.pid`

        if [ !"$?" = "0" ]; then

                rm -rf /var/run/$DEVICE.pid

                echo "ERROR: Removed stale pid file"

                exit 1

        fi

echo "PPP link to $DEVICE terminated."

exit 0

fi

echo "ERROR: PPP link is not active on $DEVICE"

exit 1

